//
// Copyright (c) 2011, Peter Lane
// Licensed under the Academic Free License version 3.0

package fan.swtChartWrapper;

import fan.fwt.*;
import fan.sys.*;
import org.eclipse.swtchart.ISeries;

public class SeriesPeer {
  ISeries _series = null;
  
  public static SeriesPeer make (fan.swtChartWrapper.Series self) throws Exception {
    return new SeriesPeer ();
  }

  String _label = "";
  public String label (fan.swtChartWrapper.Series self) { return _label; }
  public void label (fan.swtChartWrapper.Series self, String v) {
    _label = v;
  } 

  SeriesLabel _pointFormat = SeriesLabel.make ();
  public SeriesLabel pointFormat (fan.swtChartWrapper.Series self) { return _pointFormat; }
  public void pointFormat (fan.swtChartWrapper.Series self, Object v) {} // ignore this

  boolean _enableStack = false;
  public boolean enableStack (fan.swtChartWrapper.Series self) { return _enableStack; }
  public void enableStack (fan.swtChartWrapper.Series self, boolean v) {
    _enableStack = v;
  } 

  ErrorBar _xErrorBar = ErrorBar.make ();
  public ErrorBar xErrorBar (fan.swtChartWrapper.Series self) { return _xErrorBar; }

  ErrorBar _yErrorBar = ErrorBar.make ();
  public ErrorBar yErrorBar (fan.swtChartWrapper.Series self) { return _yErrorBar; }

  // utility methods

  void setXPoints (List points) {
    _series.setXSeries (Utility.toDoubleArray (points));
  }
  
  void setYPoints (List points) {
    _series.setYSeries (Utility.toDoubleArray (points));
  }

  // following get overriden in child classes
  public void setISeries (ISeries series) {}
  public ISeries.SeriesType type () { return ISeries.SeriesType.LINE; }
}
